home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
nodlst.arc
/
IPXLIBR.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-10-16
|
6KB
|
279 lines
;
; IPXLIB.ASM - Library of ASM routines for IPX/SPX
;
.MODEL SMALL
.DATA
;Address of IPX
IPXAddress dw 2 dup(0)
.CODE
PUBLIC _IPXInitialize
PUBLIC _IPXOpenSocket
PUBLIC _IPXCloseSocket
PUBLIC _IPXGetLocalTarget
PUBLIC _IPXSendPacket
PUBLIC _IPXListenForPacket
PUBLIC _IPXRelinquishControl
PUBLIC _IPXGetIntervalMarker
PUBLIC _SPXEstablishConnection
PUBLIC _SPXListenForSequencedPacket
PUBLIC _SPXSendSequencedPacket
PUBLIC _SPXTerminateConnection
; int IPXInitialize( void );
; Initializes IPX/SPX mechanism, returns TRUE if IPX is installed,
; FALSE (0) if not installed.
;
_IPXInitialize proc near
mov ax, 7A00h ; Looking for address of 7Ah
int 2Fh ; Call Multiplex interrupt
mov IPXAddress, di ; Store address
mov IPXAddress + 2, es
and ax, 00FFh ; Mask off AH to return status in AL
ret
_IPXInitialize endp
; int IPXOpenSocket(BYTE *socketNumber, BYTE socketType);
; Opens socket socketNumber as socketType (either Temporary or Permanent)
; Returns 0 on success.
;
_IPXOpenSocket proc near
push bp ; Establish standard parameter frame
mov bp, sp
mov bx, [bp + 4] ; Place socketNumber in high-low order
mov dl, byte ptr [bx]
mov dh, byte ptr [bx + 1]
mov al, [bp + 6] ; AL gets socketType
mov bx, 0
call dword ptr DGROUP:IPXAddress ; Make far call to IPXAddress
pop bp ; Restore stack frame & return
and ax, 00FFh
ret
_IPXOpenSocket endp
; void IPXCloseSocket(WORD socketNumber);
; Close socket socketNumber.
;
_IPXCloseSocket proc near
push bp
mov bp, sp
mov bx, [bp + 4]
mov dx, bx
mov bx, 1
call dword ptr DGROUP:IPXAddress
pop bp
ret
_IPXCloseSocket endp
; int IPXGetLocalTarget(BYTE *networkAddress,BYTE *immediateAddress,WORD *transportTime);
; A 10-byte networkAddress is passed to IPX, which returns the immediteAddress
; to be placed in the ECB and transportTime, an estimate (in clock ticks) of the
; time to send the packet from the source to the destination node.
; Returns 0 on success.
;
_IPXGetLocalTarget proc near
push bp
mov bp, sp
push si
mov bx, [bp + 4]
mov si, bx
mov bx, [bp + 6]
mov di, bx
mov bx, 2
call dword ptr DGROUP:IPXAddress
mov bp, sp ; restore BP (IPX kills it)
add bp, 2 ; account for SI push
mov bx, [bp + 8] ; get address of
mov [bx], cx ; place CX at *
pop si
pop bp
and ax, 00FFh
ret
_IPXGetLocalTarget endp
; void IPXSendPacket(ECB *eventControlBlock);
; Sends an IPX packet.
;
_IPXSendPacket proc near
push bp
mov bp, sp
push si
mov ax, DGROUP
mov es, ax
mov bx, [bp + 4]
mov si, bx
mov bx, 3
call dword ptr DGROUP:IPXAddress
push ds
pop es
pop si
pop bp
ret
_IPXSendPacket endp
; int IPXListenForPacket(ECB *eventControlBlock);
; Listens for an IPX packet using the passed Event Control Block.
; Returns 0 if able to post the listen request.
;
_IPXListenForPacket proc near
push bp
mov bp, sp
push si
mov ax, DGROUP
mov es, ax
mov bx, [bp + 4]
mov si, bx
mov bx, 4
call dword ptr DGROUP:IPXAddress
push ds
pop es
pop si
pop bp
and ax, 00FFh
ret
_IPXListenForPacket endp
; void IPXRelinquishControl(void);
; Relinquishes control to IPX for other processing.
;
_IPXRelinquishControl proc near
mov bx, 0Ah
call dword ptr DGROUP:IPXAddress
ret
_IPXRelinquishControl endp
; unsigned int IPXGetIntervalMarker(void);
; Gets a timer tick marker from IPX.
;
_IPXGetIntervalMarker proc near
mov bx, 8
call dword ptr DGROUP:IPXAddress
ret
_IPXGetIntervalMarker endp
; int SPXEstablishConnection( BYTE RetryCount, BYTE Watchdog, WORD *connectionID, ECB *ECBptr );
; Makes an SPX connection with the target listening node.
; Returns 0 if able to attempt connection.
;
_SPXEstablishConnection proc near
push bp
mov bp, sp
push si
mov ax, DGROUP
mov es, ax
mov bx, [bp + 4]
mov al, bl
mov bx, [bp + 6]
mov ah, bl
mov bx, [bp + 10]
mov si, bx
mov bx, 11h
call dword ptr DGROUP:IPXAddress
mov bp, sp ; restore BP (IPX kills it)
add bp, 2 ; account for SI push
mov bx, [bp + 8] ; get address of
mov [bx], dx ; place DX at *
push ds
pop es
pop si
pop bp
and ax, 00FFh
ret
_SPXEstablishConnection endp
; void SPXListenForSequencedPacket( ECB *ECBptr );
; Posts a listening ECB to receive an SPX packet.
;
_SPXListenForSequencedPacket proc near
push bp
mov bp, sp
push si
mov ax, DGROUP
mov es, ax
mov bx, [bp + 4]
mov si, bx
mov bx, 17h
call dword ptr DGROUP:IPXAddress
push ds
pop es
pop si
pop bp
ret
_SPXListenForSequencedPacket endp
; void SPXSendSequencedPacket( WORD ConnectionID, ECB *ECBptr );
; Sends an SPX packet.
;
_SPXSendSequencedPacket proc near
push bp
mov bp, sp
push si
mov ax, DGROUP
mov es, ax
mov bx, [bp + 4]
mov dx, bx
mov bx, [bp + 6]
mov si, bx
mov bx, 16h
call dword ptr DGROUP:IPXAddress
push ds
pop es
pop si
pop bp
ret
_SPXSendSequencedPacket endp
; void SPXTerminateConnection( WORD ConnectionID, ECB *ECBptr );
; Terminates an SPX connection.
;
_SPXTerminateConnection proc near
push bp
mov bp, sp
push si
mov ax, DGROUP
mov es, ax
mov bx, [bp + 4]
mov dx, bx
mov bx, [bp + 6]
mov si, bx
mov bx, 13h
call dword ptr DGROUP:IPXAddress
push ds
pop es
pop si
pop bp
ret
_SPXTerminateConnection endp
END